package indi.zhifa.study2024.generaltest.logic.helloworld.entity.response;

import lombok.Data;

import java.text.DecimalFormat;

@Data
public class ServerInfo {
    Integer availableProcess;
    Long totalPhysicalMemory;
    public String getTotalPhysicalMemoryDesc() {
        if(totalPhysicalMemory != null) {
            DecimalFormat df = new DecimalFormat("#.00");
            return df.format(totalPhysicalMemory/1024.0/1024.0)+"M";
        }
        return "0";
    }
    Long freePhysicalMemory;
    public String getFreePhysicalMemoryDesc() {
        if(freePhysicalMemory != null) {
            DecimalFormat df = new DecimalFormat("#.00");
            return df.format(freePhysicalMemory/1024.0/1024.0)+"M";
        }
        return "0";
    }
    Double systemCpuLoad;
}
